gh-144377: Clean up sqlite3 Connection's list of weakrefs to Cursor objects#144378
gh-144377: Clean up sqlite3 Connection's list of weakrefs to Cursor objects#144378vstinner merged 2 commits intopython:mainfrom
Conversation
f65eac1 to
203cb74
Compare
vstinner
left a comment
There was a problem hiding this comment.
LGTM. Please remove pycore_weakref.h include.
| Py_ssize_t imax = PyList_GET_SIZE(self->cursors); | ||
| for (Py_ssize_t i = 0; i < imax; i++) { | ||
| PyObject* weakref = PyList_GET_ITEM(self->cursors, i); | ||
| if (_PyWeakref_IsDead(weakref)) { |
There was a problem hiding this comment.
Since the internal _PyWeakref_IsDead() function is no longer used, you can remove #include "pycore_weakref.h".
There was a problem hiding this comment.
Will do, but this made me realise that there's no equivalent function to clean up self->blobs, which otherwise is a parallel of self->cursors. So if you have a long-lived connection object and keep using conn.blobopen(), the list of weakrefs will grow indefinitely.
Is that a problem, or am I missing something?
There was a problem hiding this comment.
Is that a problem, or am I missing something?
If you consider that it's an issue, please open a separated issue. It's not directly related to this change.
|
Merged. Thanks for the cleanup change. |
This cleans up the code for an unused (as far as I can see) list of Cursor weakrefs.
Closes #144377